/**
 * 
 */
package com.planner.core.action.node;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.beans.factory.annotation.Required;

import com.planner.core.action.node.form.ManageNodesForm;
import com.planner.core.service.core.stop.StopService;
import com.planner.core.vo.GraphNode;

/**
 * @author Sangharsh
 *
 */
public class ManageNodesAction extends AbstractNodeAction {
	
	private static final Log LOG = LogFactory.getLog(ManageNodesAction.class);
	
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ManageNodesForm manageNodesForm = (ManageNodesForm)form;
		LOG.info("Executing Action ManageNodesAction");
		List<GraphNode> nodes = stopService.getAllNodes();
		manageNodesForm.setNodes(nodes);
		return mapping.findForward(SUCCESS_FORWARD);
	}
	/**
	 * @param stopService the stopService to set
	 */
	@Required
	public void setStopService(StopService stopService) {
		this.stopService = stopService;
	}
}
